package com.zhoujian.Strategy;

public class Client {
    public static void main(String[] args) {
        //定义一个调用方
        Calculator calculator = new Calculator();

        //计算加法
        Operation operation = new Addition();
        calculator.setOperation(operation);
        double result = calculator.calculate(1.2,2.3);
        System.out.println(result);

        //计算减法
        operation = new Subtraction();
        calculator.setOperation(operation);
        result = calculator.calculate(2.3,1.2);
        System.out.println(result);
    }
}
